Paul's JavaScript Examples | ||
A handy script that can be used for eg. playing a semi-random soundfile (like a MIDI sequence) when a visitor arrives, so that the background sound is not always the same. (see the top of this page for an example) There are loads of other possibilities for this kind of script as well.
Example
This script is automatically started when the page is loaded.
Usage
This script is automatically started when the page is loaded.
Source
<SCRIPT LANGUAGE="javascript"> <!-- var numfiles = 7 day = new Date() z = day.getTime() y = (z - (parseInt(z/1000,10) * 1000))/10 x = parseInt(y/100*numfiles,10) + 1 midi=("eternalflame.mid") mtitl=("Bangles - Eternal Flame") if (x == (0)) { midi=("deep9.mid") mtitl=("StarTrek Deep Space Nine Theme") } if (x == (1)) { midi=("eannie55.mid") mtitl=("I Dream Of Jeannie Theme") } if (x == (2)) { midi=("goaway.mid") mtitl=("Gloria Estefan - Go Away") } if (x == (3)) { midi=("thankyou.mid") mtitl=("ABBA - Thank you for the music") } if (x == (4)) { midi=("sea2032.mid") mtitl=("SeaQuest 2032 Theme") } if (x == (5)) { midi=("babywalk.mid") mtitl=("Baby Elephants Walk Theme") } if (x == (6)) { midi=("time.mid") mtitl=("Billy Joel - For the longest time") } if (x == (7)) { midi=("popcorn.mid") mtitl=("Popcorn Theme") } document.write('<DIV ALIGN=CENTER><FONT SIZE=-1>Now playing file ' + midi + ' -> ' + mtitl + '</FONT></DIV>') // --> </SCRIPT>